﻿

namespace POI.eTransmittal.BusinessRule
{
    using System;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Web.Services;
    using System.Web.Services.Protocols;
    using System.Xml.Serialization;
    using System.Configuration;

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Web.Services.WebServiceBindingAttribute(Name = "ADSIQuerySoap", Namespace = "http://tempuri.org/")]
    public partial class ADSIQuery : System.Web.Services.Protocols.SoapHttpClientProtocol
    {

        private System.Threading.SendOrPostCallback QueryOperationCompleted;

        private System.Threading.SendOrPostCallback QueryExtendedOperationCompleted;

        /// <remarks/>
        public ADSIQuery(string url)
        {
            this.Url = url;//ConfigurationManager.AppSettings["LDAP_URL"];// "http://jakarta10/LDAPQueryWebService/LDAPQuery.asmx";
        }

        /// <remarks/>
        public event QueryCompletedEventHandler QueryCompleted;

        /// <remarks/>
        public event QueryExtendedCompletedEventHandler QueryExtendedCompleted;

        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/Query", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public string[] Query(string userName)
        {
            object[] results = this.Invoke("Query", new object[] {
                    userName});
            return ((string[])(results[0]));
        }

        /// <remarks/>
        public System.IAsyncResult BeginQuery(string userName, System.AsyncCallback callback, object asyncState)
        {
            return this.BeginInvoke("Query", new object[] {
                    userName}, callback, asyncState);
        }

        /// <remarks/>
        public string[] EndQuery(System.IAsyncResult asyncResult)
        {
            object[] results = this.EndInvoke(asyncResult);
            return ((string[])(results[0]));
        }

        /// <remarks/>
        public void QueryAsync(string userName)
        {
            this.QueryAsync(userName, null);
        }

        /// <remarks/>
        public void QueryAsync(string userName, object userState)
        {
            if ((this.QueryOperationCompleted == null))
            {
                this.QueryOperationCompleted = new System.Threading.SendOrPostCallback(this.OnQueryOperationCompleted);
            }
            this.InvokeAsync("Query", new object[] {
                    userName}, this.QueryOperationCompleted, userState);
        }

        private void OnQueryOperationCompleted(object arg)
        {
            if ((this.QueryCompleted != null))
            {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.QueryCompleted(this, new QueryCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }

        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/QueryExtended", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public string[] QueryExtended(string filter, string[] properties)
        {
            object[] results = this.Invoke("QueryExtended", new object[] {
                    filter,
                    properties});
            return ((string[])(results[0]));
        }

        /// <remarks/>
        public System.IAsyncResult BeginQueryExtended(string filter, string[] properties, System.AsyncCallback callback, object asyncState)
        {
            return this.BeginInvoke("QueryExtended", new object[] {
                    filter,
                    properties}, callback, asyncState);
        }

        /// <remarks/>
        public string[] EndQueryExtended(System.IAsyncResult asyncResult)
        {
            object[] results = this.EndInvoke(asyncResult);
            return ((string[])(results[0]));
        }

        /// <remarks/>
        public void QueryExtendedAsync(string filter, string[] properties)
        {
            this.QueryExtendedAsync(filter, properties, null);
        }

        /// <remarks/>
        public void QueryExtendedAsync(string filter, string[] properties, object userState)
        {
            if ((this.QueryExtendedOperationCompleted == null))
            {
                this.QueryExtendedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnQueryExtendedOperationCompleted);
            }
            this.InvokeAsync("QueryExtended", new object[] {
                    filter,
                    properties}, this.QueryExtendedOperationCompleted, userState);
        }

        private void OnQueryExtendedOperationCompleted(object arg)
        {
            if ((this.QueryExtendedCompleted != null))
            {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.QueryExtendedCompleted(this, new QueryExtendedCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }

        /// <remarks/>
        public new void CancelAsync(object userState)
        {
            base.CancelAsync(userState);
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    public delegate void QueryCompletedEventHandler(object sender, QueryCompletedEventArgs e);

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class QueryCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
    {

        private object[] results;

        internal QueryCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState)
            :
                base(exception, cancelled, userState)
        {
            this.results = results;
        }

        /// <remarks/>
        public string[] Result
        {
            get
            {
                this.RaiseExceptionIfNecessary();
                return ((string[])(this.results[0]));
            }
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    public delegate void QueryExtendedCompletedEventHandler(object sender, QueryExtendedCompletedEventArgs e);

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class QueryExtendedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
    {

        private object[] results;

        internal QueryExtendedCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState)
            :
                base(exception, cancelled, userState)
        {
            this.results = results;
        }

        /// <remarks/>
        public string[] Result
        {
            get
            {
                this.RaiseExceptionIfNecessary();
                return ((string[])(this.results[0]));
            }
        }
    }
}
